package br.ita.magiu.metadata.util;

import java.security.InvalidParameterException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class BrazilianDateFormatter extends TypeFormatter {

	public BrazilianDateFormatter() {
		super(Calendar.class);
	}

	public BrazilianDateFormatter(Class<?> expectedType) {
		super(expectedType);
	}

	@Override
	public String formatObject(Object obj) {
		if (obj == null)
			throw new InvalidParameterException();
		DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
		return df.format(((Calendar) obj).getTime());
	}
}
